package com.hue.gulimailcart.controller;

import com.hue.common.utils.R;
import com.hue.gulimailcart.service.CartService;
import com.hue.gulimailcart.service.ItemService;
import com.hue.gulimailcart.vo.CartItem;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: 姚凤桥
 * @Date: 2021/12/25 15:28
 * @Description:
 */
@RestController
@RequestMapping("/item")
public class ItemController {
    @Autowired
    private ItemService itemService;

    @GetMapping("/getByMemberId")
    public R getByMemberId(@RequestParam("memberId") Long memberId) {
        List<CartItem> items = itemService.getByMemberId(memberId);

        return R.ok().put("data",items);
    }
}
